package org.rqb;

import lombok.extern.slf4j.Slf4j;

import java.awt.*;
import java.io.File;
import java.net.URISyntaxException;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;

@Slf4j
public class Constant {
    public static final Integer FRAME_WIDTH = 1200;
    public static final Integer FRAME_HEIGHT = 600;

    public static final Integer CHAT_FRAME_WIDTH = 800;
    public static final Integer CHAT_FRAME_HEIGHT = 600;
    public static final int MAX_CHAT_HEIGHT = 400; // 限制聊天框的最大高度
    public static final int MAX_CHAT_WIDTH = 200; // 限制聊天框的最大高度
    public static final String REPEAT_NUM = "repeatNum";

    public static final Integer AD_WIDTH = 300;
    public static final Integer AD_BTN_WIDTH = 100;
    public static final Integer AD_BTN_HEIGHT = 20;
    public static final String AD_BTN_TEXT = "支持作者";
    public static final String AD_BTN_TEXT_HID = "客官来都来了，买箱梨呗";
    public static final String EXECUTED_TIMES_STR = "已经执行%s次";

    public static final String TOP_LEFT = "topLeft";
    public static final String TOP_RIGHT = "topRight";
    public static final String DOWN_LEFT = "downLeft";
    public static final String DOWN_RIGHT = "downRight";
    public static final int Side_length = 20;   //四个角的边长

    public static final HashMap<String,String> commodityMap = new HashMap<>();
    static {
        commodityMap.put("douyin.png","https://v.douyin.com/iZay-knRbp0");
        commodityMap.put("jingdong.png","https://v.douyin.com/iZay-knRbp0");
        commodityMap.put("pinduoduo.png","https://v.douyin.com/iZay-knRbp0");
        commodityMap.put("taobao.png","https://v.douyin.com/iZay-knRbp0");
    }



    public static final Integer FONT_SIZE = 12;



    public static final int PORT = 65534; // 本地Socket端口


    public static final String USER_HOME = System.getProperty("user.home");
    public static String WORK_DIR;  //工作目录
    public static final int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width; //屏幕宽度
    public static final int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height; //屏幕高度
    static {
        try {
            String jarPath = Constant.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
            // 获取工作目录
            File jarFile = new File(jarPath);
            WORK_DIR = jarFile.getParent();



        } catch (URISyntaxException e) {
            log.error(e.getMessage());
            throw new RuntimeException(e);
        }
    }


    public static final String CONFIG_START_UP_FIELD = "startUpOnPower";
    public static final String CONFIG_HIED_ONEXIT_FIELD = "hideOnExit";

    public static final String CONFIG_SIGN_FILE_DIR = "signSaveFileDir";
    public static final String PROXY_ENABLED = "proxyEnabled";
    public static final String PROXY_HOST = "proxyHost";
    public static final String PROXY_PORT = "proxyPort";
    public static final String M3U8_SAVE_DIR = "m3u8SaveDir";
    public static final String AUTO_HIDE_WINDOW_ONSTART = "autoHideWindowOnstart";
    public static final String GESTURE_ENABLED = "gestureEnabled";
    public static final String CLICK_FREQUENCY = "clickFrequency";

    public static final String INSTALL_PKG = "weToolBox.exe";


    public static final String EXIST = "exist"; //已经启动，申请展示已经存在的程序界面


    public static final DateTimeFormatter DEFAULTDATETIMEFORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

}
